#include <iostream>
#include <vector>
#include "geometry.h"

int main()
{
   polygon pol = polygon();

   int m;
   std::cin >> m;
   for (int i = 0; i < m; i++)
   {
      double x, y;
      std::cin >> x >> y;
      if (pol.in_polygon(point(x, y)))
      {
         std::cout << "YES\n";
      } else 
      {
         std::cout << "NO\n";
      }
   }
   return 0;
}